<template>
  <div class="configInfo">
    <h3>
      {{$t('configLazyLoad.channel.enterpriseTip14')}}</br>
      {{$t('configLazyLoad.channel.enterpriseTip014')}}
    </h3>
    <el-form class="form" ref="ruleForm" :model="configForm"  label-position="left" label-width="120px">
      <el-form-item label="URL：" prop="server_url">
        <el-input v-model.trim="configForm.server_url" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="token：" prop="token">
        <el-input v-model.trim="configForm.token" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="EncodingAESKey：" prop="encoding_AESKey">
        <el-input v-model.trim="configForm.encoding_AESKey" :disabled="true"></el-input>
      </el-form-item>
    </el-form>
    <h3>{{$t('configLazyLoad.channel.enterpriseTip15')}}</h3>
    <div v-if="showAddOrEditType === 'add'" class="btn">
      <el-button type="primary" class="primary_btn" @click="saveFun()">{{$t('public.finish')}}</el-button>
    </div>
  </div>
</template>
<script>
import { randomWord, deepClone } from '@/utils/m7Utils'
import bus from '@/store/eventBus'
export default {
  name: 'enterpriseConfigInfo',
  data () {
    return {
      configForm: {}
    }
  },
  props: {
    configData: {
      type: Object,
      default:  () => {
        return {}
      }
    },
    showAddOrEditType: {
      type: String,
      default: () => {
        return 'add'
      }
    }
  },
  methods: {
    saveFun () {
      bus.$emit('enterpriseSaveFun')
    },
    initData () {
      let form = deepClone(this.configData)
      this.configForm.server_url = form.server_url
      this.configForm.token = form.token
      this.configForm.encoding_AESKey = form.encoding_AESKey
    }
  },
  beforeMount () {
   this.initData()
  }
}
</script>
<style lang="stylus" scoped>
  @import "../../../../../assets/common.styl"
  .configInfo
    margin 30px auto
    width 540px
    .form
      width 500px
      margin 20px 30px
    .btn
      margin-top 20px  
</style>